package com.lagou.mr.homework;


import org.apache.commons.lang3.StringUtils;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class NumberMapper extends Mapper<LongWritable, Text, NumberSort, NullWritable> {

    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        if (StringUtils.isNotEmpty(value.toString())){
            NumberSort bean = new NumberSort(Integer.parseInt(value.toString()));
            context.write(bean, NullWritable.get());
        }
    }
}
